package com.itheima.service.db.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.domain.db.Announcement;
import com.itheima.domain.db.Notification;
import com.itheima.mapper.NotificationMapper;
import com.itheima.service.db.NotificationService;
import com.itheima.vo.PageBeanVo;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author zsk
 * @create 2022-03-14-19:42
 */
@DubboService
public class NotificationServiceImpl implements NotificationService {

    //依赖注入
    @Autowired
    private NotificationMapper notificationMapper;

    //根据UserId查询数据
    @Override
    public Notification findByUserId(Long userId) {
        //构建查询条件
        LambdaQueryWrapper<Notification> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Notification::getUserId,userId);

        //查询
        return notificationMapper.selectOne(wrapper);



    }

    //新增系统设置
    @Override
    public void save(Notification notificationParam) {
        notificationMapper.insert(notificationParam);
    }

    //修改系统设置
    @Override
    public void update(Notification notificationParam) {
        notificationMapper.updateById(notificationParam);
    }

}
